register ucsb.appscale.protoBuff.jar
register /root/software/apache-cassandra-0.7.4-src/lib/commons-lang-2.4.jar
register /root/software/apache-cassandra-0.7.4-src/lib/libthrift-0.5.jar
register /root/appscale/AppServer_Java/appengine-java-sdk-repacked/lib/impl/appengine-api.jar
register /root/software/apache-cassandra-0.7.4-src/lib/google-collections-1.0.jar

/*
Greeting: (author, content, date)
count unique authors
*/

set DEFAULT_PARALLEL 2;
rows = LOAD 'cassandra://greeting_100000/Standard1' USING org.apache.cassandra.hadoop.pig.CassandraStorage();
entityRows = filter rows by $0 matches 'guestbook___Greeting___1/guestbook/Greeting.*';
entity = foreach entityRows generate ucsb.appscale.protoBuff.Parse($1);
authors = foreach entity generate $0#'author' as author;
unique_authors = DISTINCT authors;
all_authors = group unique_authors all;
number = foreach all_authors generate COUNT(unique_authors);
-- this stores it back into HDFS
store number into 'greeting1000aaa' USING PigStorage (',');
